package yifeng.program.beauty;

public class P2_3 {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		
	}
	
	
	public static String findTheMostFrequent(String[] allIds){
		//null 和 length=0 判断
		
		
		String currentID = null;
		int currentIDTimes = 0;
		
		
		//null判断
		for(String id : allIds){
			if(currentIDTimes == 0){
				currentID = id;
				currentIDTimes = 1;
			}else{
				if(id.equals(currentID)){
					currentIDTimes++;
				}else{
					currentIDTimes--;
				}
			}
		}
		
		
		return currentID;
	}
	
	public static String[] findTheMost3Frequent(String[] allIds){
		IDBean[] idBeans = new IDBean[3];
		int beanAmount = 0;
		/**
		 * 有空位置，放进去
		 * 没有空位置，且有相同，则++
		 * 没有空位置，且没相同，则全--
		 */
		for(String id : allIds){
			if(beanAmount < 3){
				IDBean bean = new IDBean();
				bean.id = id;
			}
			
		}
		
		return null;
	}
	
	static class IDBean{
		String id;
		int times;
	}
}
